<?php 
	header("content-type:text/html;charset=utf-8");
	$pdo = new PDO("mysql:host=127.0.0.1;dbname=lianxi;charset=utf8","root","root");
	$redis = new Redis();
	$redis->connect("127.0.0.1","6379");
	$id = $_GET['id'];
	$sql = "select * from `fenye` where id = $id";
	$data = $pdo->query($sql)->fetch();
	if($redis->get("visit".$id)){
		$redis->incr("visit".$id);
		$visit = $redis->get("visit".$id);
	}else{
		$redis->incr("visit".$id,1);
		$visit = $redis->get("visit".$id);
	}
 ?>
 <!DOCTYPE html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<title>Document</title>
 </head>
 <body>
 	<center>
 		这是你<?php echo $visit;?>次访问此商品
 		<table>
 			<tbody>
 				<tr>
 					<td>商品名</td>
 					<td>价格</td>
 					<td>数量</td>
 				</tr>
 				<tr>
 					<td><?php echo $data['name']?></td>
 					<td><?php echo $data['moneyo']?></td>
 					<td>100</td>
 				</tr>
 			</tbody>
 		</table>
 	</center>
 </body>
 </html>